package day5;

import day4.Point;

public class Rectangle {

    Point location;
    int width;
    int height;


    public Rectangle() {

    }

    public Rectangle(int width, int height, Point location) {
        this.location = location;
        this.width = width;
        this.height = height;
    }

    public Rectangle(int width, int height, int x, int y) {

        this.location = new Point(x, y);
        this.width = width;
        this.height = height;
    }

    public double area() {
        return width * height;
    }

    public boolean container(Point p) {
        return p.x >= location.x && p.x <= location.x + width && p.y >= location.y && p.y <= location.y + height;
    }
    public boolean container(int x, int y) {
        return x >= location.x && x <= location.x + width && y >= location.y && y <= location.y + height;
    }

}

